package tq.com.tqteacher.mine.activity;

import android.view.View;

import tq.com.tqcom.base.BaseFragment;
import tq.com.tqcom.base.BaseTitleActivity;
import tq.com.tqteacher.mine.fragment.TQBuyInfoFragment;
import tq.com.tqteacher.mine.fragment.TQClassCardFragment;
import tq.com.tqteacher.mine.fragment.TQClassInfoFragment;
import tq.com.tqteacher.mine.fragment.TQClassIntrFragment;
import tq.com.tqteacher.mine.fragment.TQClassOverInfoFragment;
import tq.com.tqteacher.mine.fragment.TQPersonSettingFragment;
import tq.com.tqteacher.mine.fragment.TQTeacherIntrFragment;

public class TQClassInfoActivity extends BaseTitleActivity {
    private BaseFragment mBaseFragment;
    @Override
    protected BaseFragment fragment() {
        int key = getIntent().getIntExtra("index", 0);
        switch (key){
            case 0: {
                setHeaderTitle("班级信息");
                return new TQClassInfoFragment();
            }
            case 1:{
                setHeaderTitle("内容简介");
                return new TQClassIntrFragment();
            }
            case 2:{
                setHeaderTitle("班卡信息");
                return new TQClassCardFragment();
            }
            case 3:{
                setHeaderTitle("班级概况");
                return new TQClassOverInfoFragment();
            }
            case 4:{
                setHeaderTitle("个人设置");
                return new TQPersonSettingFragment();
            }
            case 5:{
                mHeader5View.getRightView().setText("完成");
                setHeaderTitle("老师简介");
                mHeader5View.getRightView().setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        submit();
                    }
                });
                mBaseFragment = new TQTeacherIntrFragment();
                return mBaseFragment;
            }
            case 6:{
                setHeaderTitle("班卡激活人数");
                return new TQBuyInfoFragment();
            }
            case 7:{
                setHeaderTitle("线上班卡购买人数");
                TQBuyInfoFragment lBuyInfoFragment = new TQBuyInfoFragment();
                lBuyInfoFragment.setType(1);
                return lBuyInfoFragment;
            }
        }
        return null;
    }

    private void submit(){
        if(mBaseFragment instanceof TQTeacherIntrFragment){
            ((TQTeacherIntrFragment)mBaseFragment).submit();
        }
    }
}
